package com.simon.codepiece.serializable.fastjson;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
/**
 * 
 * ps：v2版本和原始版本差别就是，这个记录了class 路径
 *
 */
public class JsonSerializerUtilv2 {

	public byte[] serialize(Object source) {
		if (source == null) {
			return null;
		}

		return JSON.toJSONBytes(source, SerializerFeature.WriteClassName);

	}

	public Object deserialize(byte[] source) {
		if (source == null || source.length == 0) {
			return null;
		}

		return JSON.parse(source);

	}

}
